package com.yqd.d1_encapsulation.demo1;

public class Circle {
    private Integer radius;

    public Integer getRadius() {
        return radius;
    }

    public void setRadius(Integer radius) throws Exception {
        if (radius >= 0) {
            this.radius = radius;
        } else {
            throw new Exception("请输入正确的圆的半径");
        }
    }

    public void draw() {
        System.out.println("画圆半径：" + this.radius + "的圆");
    }
}
